const http = require('http');

const fs = require('fs');

var sv = http.createServer();

sv.on('request',(req,res)=>{

    res.setHeader('Access-Control-Allow-Origin','*');
    res.setHeader('Content-Type','text/plain;charset=utf-8');

    var data = fs.readFileSync('city.json');
    res.end(data);//读的流返回给前端
});

sv.listen(3000,()=>{console.log('已启动服务器，端口号：3000')});